
 <template>
 	<el-dialog title="" width="60%" visible :show-close="false" :append-to-body="true" class="wrap" >
 		<i class="el-icon-close close" @click="cancel" style="color: white;z-index: 99;"></i>
		 <div class="bt">批量同步教室时间段</div>
 		<el-form label-width="100px" class="form">
 			<div class="left" style="width: 30%;float: left; border-right:1px dashed #000;;">
 			<div style="font-size:20px;text-align: center;">教室</div>
 			<p style="border-bottom: 1px solid #969696; margin-top: 10px;"></p>
				<ul style="margin-top: 10px;">
					<li v-for='v in this.params'>{{v.jsmc}}</li>
				</ul>
		    </div>
	        <div style="width: 70%;height:100px;float: right;">
	        <div style="font-size:20px;width: 100%; text-align: center;">同步教室</div>
	        <div style="width: 100%; text-align: center;">
	        	 <el-select v-model="fromroom"  placeholder="选择教室" class="select-block">
		            <el-option   v-for='v in jslist' :label="v.jsmc" :value="v.id"></el-option>
		        </el-select>
	        </div>
	       
	        </div>
 		</el-form>
    <el-button type="danger" class="submit" @click="cancel">退出</el-button>
 		<el-button type="primary" class="submit" @click="submit">保存</el-button>
 	</el-dialog>
 </template>
 <script type="text/javascript">
 	import qs from 'qs'
 	export default {
 		props: ['params'],
 		data() {
 			return {
 				checkList:[],
        fromroom:'',
        comboxlist:[],
        jslist:[],
 				form: {
			           sjd :'',
			           sjqj:'',
			           notes :'',
			           xh :'',
			           isenable :'',
 					 id:''
 				}
 			}
 		},
 		created() {
          this.loadinfo();
          this.checkSelect;
          var aa=[];
          this.params.forEach(function(v,i){
             aa.push(v.id)
          })
          this.jsid = aa.join(",");
          this.getjslist();
 		},
 		methods: {
 			getjslist(){
				var logininfo = JSON.parse(localStorage.logininfo);
				             var params2 = qs.stringify({
				                    xxid:logininfo.xxid,
 							             yhid:logininfo.id,
				               })
				             //执行
				                 this.axios.post(this.$store.state.api + 'xxjs/getjsxlk',  params2 )
				                 .then(res => {
//				                 	console.log(res,222)
				                 	this.jslist=res.data.data.list
				                 	for(var i in this.jslist){
				                 		if(this.jslist[i].jsmc=='所有'){
				                 		   this.jslist[i]=false
				                 		}
				                 	}
				                 	
				                 }).catch(res => {
									 this.$message.warning("服务器异常");
								})
 			},
   			loadinfo(){
  				var logininfo = JSON.parse(localStorage.logininfo);
  				             var params2 = qs.stringify({
  				                  xxid:logininfo.xxid,
   							      yhid:logininfo.id,
  				               })
  				             //执行
  				                 this.axios.post(this.$store.state.api + 'jssjd/qclist',  params2 )
  				                 .then(res => {
//				                 	console.log(res,111)
  				                 	this.comboxlist=res.data.data.list
  				                 }).catch(res => {
  									 this.$message.warning("服务器异常");
  								})
   			},
 			 submit() {
 			 	var logininfo = JSON.parse(localStorage.logininfo);
 				var params2 = qs.stringify({
 						jsids: this.jsid+'',
 						fromjsid:this.fromroom+'',
 						yhid: logininfo.id,
 						xxid: logininfo.xxid
 					});
 				//执行
 				    this.axios.post(this.$store.state.api + 'jssjd/plinsert',  params2 )
 						.then(res => {
 							if(res.data.code == 1) {
 								this.$emit('close', { type: 'plsjd', cancel: false });
 								this.$store.state.loading = false;
 							} else {
 							   this.$message.warning(res.data.msg);
 								this.$store.state.loading = false;
 							}
 						}).catch(res => {
 							this.$message.warning("服务器异常");
 							this.$store.state.loading = false;
 						})
 			},
 			cancel() {
 				this.$emit('close', { type: 'plsjd', cancel: true })
 			}
 		}
 	}
 </script>
 <style lang="less" scoped>
 	.wrap {
 		text-align: center;
 	}
 	.bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top:0;
			left:0;
			background: #50BFFF;
			margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
 	.form {
 		overflow: hidden;
 		text-align: left;
 		margin-top: 20px;
 		margin-bottom: 20px;
 	}
 	.jclt {
			width: 85%;
			height: 50px;
			float: left;
			font-size: 16px;
			text-align: center;
			line-height: 50px;
			/*border-right: 1px solid #CCCCCC;*/
			cursor: pointer;
		}
 	.input {
             display: inline-block;
         }
 	.select-block {
 		/*display: block;
        width: 85%;*/
       width: 70%;
       margin-top: 20px;
 	}
 	.submit {
 		width: 120px;
 	}
 	li{
 		text-align: center;
 	}
 	.el-checkbox+.el-checkbox {
    margin-left: 0px;
}
 </style>
